package com.campushelper.android;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;


public class adapter1 {

 int poto,logo,uicon;
 int key;
 private String nick;
 private String day;
 private String tagitem;
 private String rank;
 
 public adapter1(int poto,int logo,int uicon, String nick, String day, String tagitem, int key, String rank ){
  this.poto = poto;
  this.logo = logo;
  this.uicon = uicon;
  this.nick = nick;
  this.day = day;
  this.tagitem = tagitem;
  this.key = key;
  this.rank = rank;
  
 }

 public int getpoto() {
  return poto;
 }
 public int getlogo() {
	  return logo;
	 }
 public int getuicon() {
	  return uicon;
	 }

 public String getNick() {
  return nick;
 }

 public String getday() {
  return day;
 }
 public String gettagitem() {
	  return tagitem;
	 } 
 public int getKey() {
		  return key;
		 }
 public String getRank() {
	  return rank;
	 }
}

////////////////////////////////////////////////////////////////
class MyAdapter extends BaseAdapter{
	public String str;
	Context context;
	ArrayList <adapter1>arrData;
	LayoutInflater inflater;
	TextView nick;
	TextView day;
	TextView tagitem;
	ImageView poto;
	ImageView logo;
	ImageView uicon;
	 
 public MyAdapter(Context c, ArrayList<adapter1> arr) {
  this.context = c;
  this.arrData = arr;
  inflater = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
 }

 public int getCount() {
  return arrData.size();
 }

 public Object getItem(int position) {
  return arrData.get(position).getNick();
 }

 public long getItemId(int position) {
  return position;
 }

 public View getView(final int position, View convertView, ViewGroup parent) {

  if(convertView == null){
   convertView = inflater.inflate(R.layout.row, parent, false);
  }
  
  poto = (ImageView)convertView.findViewById(R.id.poto);
  poto.setImageResource(arrData.get(position).getpoto());
  
  logo = (ImageView)convertView.findViewById(R.id.logo);
  logo.setImageResource(arrData.get(position).getlogo());
  
  uicon = (ImageView)convertView.findViewById(R.id.uicon);
  uicon.setImageResource(arrData.get(position).getuicon());
  
  
  TextView nick = (TextView)convertView.findViewById(R.id.nick);
  nick.setText(arrData.get(position).getNick());
  
  day = (TextView)convertView.findViewById(R.id.day);
  day.setText(arrData.get(position).getday());

  tagitem =(TextView)convertView.findViewById(R.id.tagitem);
  tagitem.setText(arrData.get(position).gettagitem());
  return convertView;
 }
}